    <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%String path = request.getContextPath() ;%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="renderer" content="webkit">
    <title>APP统计概览</title>
    <link rel="stylesheet" type="text/css" href="<%=path %>/resource/lib/ligerUI/skins/Aqua/css/ligerui-all.css" />
    <link rel="stylesheet" type="text/css" href="<%=path %>/resource/lib/ligerUI/skins/sqBlue/css/all.css">
    <link rel="stylesheet" type="text/css" href="<%=path %>/resource/lib/ligerUI/skins/sqBlue/css/sq-sj.css">
    <jsp:include page="../../../import.jsp" flush="true"/>
    <style type="text/css">
        .l-text-wrapper{
            display: inline-block;
        }
        .l-form div.btnsBox{
            text-align: left;
        }
        .l-form div.btm{
            padding: 0;
        }
        .form_view{
            padding: 10px 0;
        }
    </style>
    <script src="<%=path %>/resource/lib/jquery/jquery-1.9.0.min.js" type="text/javascript"></script>
    <script src="<%=path %>/resource/lib/ligerUI/js/ligerui.all.js" type="text/javascript"></script>
    <script src="<%=path %>/resource/lib/sq.all.js" type="text/javascript"></script>
    <script type="text/javascript">
        var form=null,formData=null, data=null,dayRegionNum=null;
        $(function () {
            form = $("#searchBar").ligerForm();
            formData = form.getData();
            $.ajax({
                type: 'post',
                dataType:'json',
                url: '<%=path%>/mongo/appStats/getAppStatsDataInfo.do',
                async:false,
                data:formData,
                beforeSend:function(){
                    wait_dialog=$.ligerDialog.SQalert({content: '正在查询...',SQ_type: "waitting"});
                },
                success:function(msg){
                    wait_dialog.close();
                    if(msg.success == 1){
                        //window.open(msg.data);
                        console.log("data>>"+JSON.stringify(msg.data));
                        data = msg.data ;;
                        $("#insNum").html(data.insNum);
                        $("#regNum").html(data.regNum);
                        $("#newRegNum").html(data.newRegNum);
                        $("#liveUsrNum").html(data.liveUsrNum);
                        $("#fstCertNum").html(data.fstCertNum);
                        $("#secCertNum").html(data.secCertNum);
                        $("#conTelNum").html(data.conTelNum);
                    }else{
                        $.ligerDialog.SQalert({content:msg.info, SQ_type: "error"});
                    }
                }
            });
            /* 清空 */
            $("#clearBtn").click(function (event) {
                clearLigerForm("searchBar");
                dayRegionNum = null;
            });

            /* 查询 */
            $("#searchBtn").click(function (event) {
                form = liger.get("searchBar");
                var formData = form.getData();
                /* if(dayRegionNum){
                    formData['dayRegion'] = dayRegionNum ;
                } */
                console.log(JSON.stringify(formData));
                $.ajax({
                    type: 'post',
                    dataType:'json',
                    url: '<%=path%>/mongo/appStats/getAppStatsDataInfo.do',
                    async:false,
                    data:formData,
                    beforeSend:function(){
                        wait_dialog=$.ligerDialog.SQalert({content: '正在查询...',SQ_type: "waitting"});
                    },
                    success:function(msg){
                        wait_dialog.close();
                        if(msg.success == 1){
                            //window.open(msg.data);
                            console.log("data>>"+JSON.stringify(msg.data));
                            data = msg.data ;
                            $("#insNum").html(data.insNum);
                            $("#regNum").html(data.regNum);
                            $("#newRegNum").html(data.newRegNum);
                            $("#liveUsrNum").html(data.liveUsrNum);
                            $("#fstCertNum").html(data.fstCertNum);
                            $("#secCertNum").html(data.secCertNum);
                            $("#conTelNum").html(data.conTelNum);
                        }else{
                            $.ligerDialog.SQalert({content:msg.info, SQ_type: "error"});
                        }
                    }
                });
            });

            //导出
            $("#detailBtn").click(function (event) {
                var form = liger.get("searchBar");
                var data = form.getData();
                if(dayRegionNum){
                    data['dayRegion'] = dayRegionNum ;
                }
                var wait_dialog;
                $.ajax({
                    type: 'post',
                    dataType:'json',
                    url: '<%=path%>/mongo/appStats/exportAppStatsDataList.do',
                    data:data,
                    beforeSend:function(){
                        wait_dialog=$.ligerDialog.SQalert({content: '导出数据中...',SQ_type: "waitting"});
                    },
                    success:function(msg){
                        wait_dialog.close();
                        if(msg.success == 1){
                            //window.open(msg.data);
                            console.log(msg.data);
                            $.ligerDialog.SQalert({content:msg.info, SQ_type: "success"});
                        }else{
                            $.ligerDialog.SQalert({content:msg.info, SQ_type: "error"});
                        }
                    }
                });
            });

        });

        /**
         * 查询最近几天的统计情况
         * @param dayRegion
         * */
        function getAppStatsDataInfo(dayRegion){
            if(!dayRegion){
               $.ligerDialog.SQalert({content:"查询最近几天的数据参数不能为空！", SQ_type: "error"});
               return ;
            }
            dayRegionNum = dayRegion;
            form = liger.get("searchBar");
            var formData = form.getData();
            formData['dayRegion'] = dayRegion ;
            console.log(JSON.stringify(formData));
            $.ajax({
                type: 'post',
                dataType:'json',
                url: '<%=path%>/mongo/appStats/getAppStatsDataInfo.do',
                async:false,
                data:formData,
                beforeSend:function(){
                    wait_dialog=$.ligerDialog.SQalert({content: '正在查询...',SQ_type: "waitting"});
                },
                success:function(msg){
                    wait_dialog.close();
                    if(msg.success == 1){
                        //window.open(msg.data);
                        console.log("data>>"+JSON.stringify(msg.data));
                        data = msg.data ;
                        $("#insNum").html(data.insNum);
                        $("#regNum").html(data.regNum);
                        $("#newRegNum").html(data.newRegNum);
                        $("#liveUsrNum").html(data.liveUsrNum);
                        $("#fstCertNum").html(data.fstCertNum);
                        $("#secCertNum").html(data.secCertNum);
                        $("#conTelNum").html(data.conTelNum);
                    }else{
                        $.ligerDialog.SQalert({content:msg.info, SQ_type: "error"});
                    }
                }
            });
        }

    </script>
</head>

<body class="iframeBody">
<div class="Wrapper">
    <div class="index_content">
        <div class="passageway">
            <div class="form_view">
                <form id="searchBar">
                    <div class="fieldset1 clearFix">
                        <div class="btnsBox">
                            <span id="yBtn" class="sq-button sq-button-round" onclick="javaScript:getAppStatsDataInfo('1');">昨天</span>
                            <span id="sBtn" class="sq-button sq-button-round" onclick="javaScript:getAppStatsDataInfo('7');">近7天</span>
                            <span id="fBtn" class="sq-button sq-button-round" onclick="javaScript:getAppStatsDataInfo('15');">近15天</span>
                            <span id="tBtn" class="sq-button sq-button-round" onclick="javaScript:getAppStatsDataInfo('30');">近30天</span>
                        </div>
                        <div class="sqPanel_body">
                            <div class="fieldBox">
                                <div class="label">自定义时间设置</div>
                                <div class="field">
                                    <input name="dateMin" id="dateMin" type="text" class="ui-datepicker" value="" >
                                     - 
                                    <input name="dateMax" id="dateMax" type="text" class="ui-datepicker" value="">
                                </div>
                            </div>
                        </div>
                        <div class="btnsBox btm">
                            <span id="searchBtn" class="sq-button sq-button-round">查询</span>
                            <!-- <span id="detailBtn" class="sq-button sq-button-round">导出表格</span> -->
                            <span id="clearBtn" class="sq-button sq-button-round">清空</span>
                        </div>
                    </div>
                </form>
            </div>
            <div class="passageway_title">概览</div>
            <div class="passageway_list">
                <dl>
                    <dt id="insNum" class="text_number"></dt>
                    <dd>
                        <span class="list_title_text">APP装机量</span>
                    </dd>
                </dl>
                <dl>
                    <dt id="regNum" class="text_number"></dt>
                    <dd>
                        <span class="list_title_text">注册用户总数</span>
                    </dd>
                </dl>
                <dl>
                    <dt id="newRegNum" class="text_number"></dt>
                    <dd>
                        <span class="list_title_text">新增注册用户</span>
                    </dd>
                </dl>
                <dl>
                    <dt id="liveUsrNum" class="text_number"></dt>
                    <dd>
                        <span class="list_title_text">30天内活跃用户</span>
                    </dd>
                </dl>
                <dl>
                    <dt id="fstCertNum" class="text_number"></dt>
                    <dd>
                        <span class="list_title_text">保存企业信息</span>
                    </dd>
                </dl>
                <dl>
                    <dt id="secCertNum" class="text_number"></dt>
                    <dd>
                        <span class="list_title_text">准入通过</span>
                    </dd>
                </dl>
                <dl>
                    <dt id="conTelNum" class="text_number"></dt>
                    <dd>
                        <span class="list_title_text">电话拨号量</span>
                    </dd>
                </dl>
            </div>
        </div>
    </div>
</div>
</body>
</html>
